<template>
  <div>
    <advancedQueryList :list1="sysSearchMainListShow" :list2="sysSearchMainListHide" :list1-title="$t('展示(拖动标签可排序或隐藏)')" :list2-title="$t('隐藏(拖动标签可排序或展示)')" />

    <!-- 添加或修改高级查询对话框 -->
    <el-dialog :title="title" :visible.sync="formOpen" width="43%" :close-on-click-modal="false" :lock-scroll="false" append-to-body custom-class="dialogForm">
      <sysSearchMainForm ref="sysSearchMainForm" :module="module" :view-id="viewId" />
    </el-dialog>
  </div>
</template>

<script>
import { viewList } from '@/api/system/search/searchMainView'
import sysSearchMainForm from './sysSearchMainForm.vue'
import advancedQueryList from './advancedQueryList'
export default {
  components: {
      sysSearchMainForm,
      advancedQueryList
  },
  props: {
    module: {
      type: String,
      default: () => ''
    },
    viewId: {
      type: String,
      default: () => ''
    }
  },
  data() {
      return {
          // 遮罩层
          loading: true,
          // 高级查询表格数据
          sysSearchMainListShow: [],
          sysSearchMainListHide: [],
          // 弹出层标题
          title: this.$t('修改视图'),
          // 是否显示弹出层
          formOpen: false
          // 表单参数
      }
  },
  watch: {
  },
  mounted() {
    this.$nextTick(() => {
      this.getList()
    })
  },
  methods: {
    /** 查询高级查询列表 */
    getList() {
      this.loading = true
      this.sysSearchMainListHide = []
      this.sysSearchMainListShow = []
      viewList(this.module).then(response => {
          response.data.forEach(item => {
            if (item.isSelect === 'Y') {
              this.sysSearchMainListShow.push(item)
            } else if (item.isSelect === 'N') {
              this.sysSearchMainListHide.push(item)
            }
          })
          this.loading = false
      })
    }

  }
}
</script>
